# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time

  include AuthenticatedSystem

  # See ActionController::RequestForgeryProtection for details
  # Uncomment the :secret if you're not using the cookie session store
  protect_from_forgery # :secret => '1ff6ab1a8eb1f0f395bfe09e2138f9df'
  
  # See ActionController::Base for details 
  # Uncomment this to filter the contents of submitted sensitive data parameters
  # from your application log (in this case, all fields with names like "password"). 
  # filter_parameter_logging :password

  def check_logged_in
	if not logged_in?
	  store_location
		redirect_to(new_session_url)	
		return
	end
  end
  
  def access_denied
      if logged_in?
          render :text => "You have insufficient permissions", :status => 401
          return false
      else
          super
      end
  end
    
    
end
